﻿@model Adams.Admin.DataTransfer.Events.CreateEvent.PageLoad
@{
    Layout = "~/Views/Events/_Layout.cshtml";
}
@section Head {
    <link href="@Url.Content("/Content/jquery.ui.timepicker.css")" rel="stylesheet" type="text/css" />
}
<div class="content-box">
    <!-- Start Content Box -->
    <div class="content-box-header">
        <h3>
            Event Details</h3>
    </div>
    <!-- End .content-box-header -->
    <div class="content-box-content">
        <form action="" method="post">
        <p>
            <label>
                Calendar</label>
            <select id="Calendar" class="small-input">
                <option value="">Choose ...</option>
                @foreach (var cal in Model.Calendars)
                {
                    <option value="@cal.ID" @(Model.Event.Calendar.ID == cal.ID ? "selected" : "")>@cal.Name</option>
                }
            </select>
            <br />
            <small>which calendar does this event belong to?</small>
        </p>
        <p>
            <label>
                Title</label>
            <input class="text-input medium-input" type="text" id="Title" value="@(Model.Occurance.ID == 0 ? ViewBag.EventTitle : Model.Occurance.Title)" />
            <br />
            <small>the Title of the Event</small>
        </p>
        <p>
            <label>
                Short Description</label>
            <input class="text-input medium-input" type="text" id="ShortDescription" value="@Model.Occurance.ShortDescription" />
            <br />
            <small>enter a short decription that will be shown in feeds</small>
        </p>
        <p>
            <label>
                Location</label>
            <input class="text-input medium-input" type="text" id="Location" value="@Model.Occurance.Location" />
            <br />
            <small>where is the event taking place?</small>
        </p>
        <p>
            <label>
                Schedule</label>
            <input type="checkbox" id="IsAllDay" @(Model.Event.ID == 0 ? (ViewBag.IsAllDay ? "checked" : "") : (Model.Occurance.IsAllDay ? "checked" : "")) />All
            Day
            <br />
            @{
                DateTime sd;
                DateTime ed;
                if (Model.Event.ID == 0)
                {
                    if (string.IsNullOrEmpty(ViewBag.Start))
                    {
                        sd = Adams.Shared.DateHelper.RoundUpToNextHour(DateTime.Now);
                        ed = sd.AddHours(1);
                    }
                    else
                    {
                        sd = DateTime.Parse(ViewBag.Start);
                        ed = DateTime.Parse(ViewBag.End);
                    }
                }
                else
                {
                    sd = Model.Occurance.StartDate;
                    ed = Model.Occurance.EndDate;
                }
            }
            <input class="text-input date-input datepicker" type="text" id="StartDate" value="@sd.ToShortDateString()" />
            <input class="text-input date-input timepicker" type="text" id="StartDateTime" value="@sd.ToShortTimeString()" />
            to
            <input class="text-input date-input datepicker" type="text" id="EndDate" value="@ed.ToShortDateString()" />
            <input class="text-input date-input timepicker" type="text" id="EndDateTime" value="@ed.ToShortTimeString()" />
            <br />
            <input type="checkbox" id="IsRepeat" @(Model.Event.IsRepeat ? "checked" : "") />Repeat
            <span id="IsRepeatSummary"></span><a id='IsRepeatSummaryEdit'>edit</a>
        </p>
        <p>
            <label>
                Time Zone</label>
            <select id="TimeZone">
                <option value="-5" @(Model.Occurance.TimeZone == -5 ? "selected" : "")>Eastern Standard
                    Time (EST)</option>
                <option value="-6" @(Model.Occurance.TimeZone == -6 ? "selected" : "")>Central Standard
                    Time (CST)</option>
                <option value="-7" @(Model.Occurance.TimeZone == -7 ? "selected" : "")>Mountain Standard
                    Time (MST)</option>
                <option value="-8" @(Model.Occurance.TimeZone == -8 ? "selected" : "")>Pacific Standard
                    Time (PST)</option>
                <option value="-9" @(Model.Occurance.TimeZone == -9 ? "selected" : "")>Alaskan Standard
                    Time (AKST)</option>
                <option value="-10" @(Model.Occurance.TimeZone == -10 ? "selected" : "")>Hawaii-Aleutian
                    Standard Time (HST)</option>
            </select>
            <br />
            <small></small>
        </p>
        <p>
            <label>
                Description</label>
            <textarea class="text-input textarea wysiwyg" id="Description" cols="79" rows="15">@Model.Occurance.Description</textarea>
        </p>
        <p>
            <input class="button" id="submit" type="button" value="Save" />
            <input class="button" id="cancel" type="button" value="Discard Changes" />
            <input class="button" id="delete" type="button" value="Delete" />
        </p>
        <div class="clear">
        </div>
        <!-- End .clear -->
        <input id="OccuranceID" type="hidden" value="@(Model.Occurance == null ? 0 : Model.Occurance.ID)" />
        </form>
    </div>
    <!-- End .content-box-content -->
</div>
<!-- End .content-box -->
<div id="repeat" class="content-box hidden" style="color: #555;">
    <div class="content-box-header">
        <h3>
            Repeat</h3>
    </div>
    <div class="content-box-content">
        <form action="">
        <p>
            Repeats:
            <select id="RepeatType">
                <option value="1" @(Model.Event.RepeatType == 1 ? "selected" : "")>Daily</option>
                <option value="2" @(Model.Event.RepeatType == 2 ? "selected" : "")>Weekly</option>
                <option value="3" @(Model.Event.RepeatType == 3 ? "selected" : "")>Monthly</option>
                <option value="4" @(Model.Event.RepeatType == 4 ? "selected" : "")>Yearly</option>
            </select>
        </p>
        <p>
            Repeat every:
            <select id="RepeatEvery">
                @for (int i = 1; i <= 30; i++)
                {
                    <option value="@i" @(Model.Event.RepeatEvery == i ? "selected" : "")>@i</option>
                }
            </select>
            <span id="RepeatEveryIndicator"></span>
        </p>
        <p id="repeatweekly">
        Repeats On:
            <input type="checkbox" id="RepeatWeeklySun" @(Model.Event.RepeatWeeklySun ? "checked" : "")/> S
            <input type="checkbox" id="RepeatWeeklyMon" @(Model.Event.RepeatWeeklyMon ? "checked" : "")/> M
            <input type="checkbox" id="RepeatWeeklyTeu" @(Model.Event.RepeatWeeklyTeu ? "checked" : "")/> T
            <input type="checkbox" id="RepeatWeeklyWed" @(Model.Event.RepeatWeeklyWed ? "checked" : "")/> W
            <input type="checkbox" id="RepeatWeeklyThu" @(Model.Event.RepeatWeeklyThu ? "checked" : "")/> T
            <input type="checkbox" id="RepeatWeeklyFri" @(Model.Event.RepeatWeeklyFri ? "checked" : "")/> R
            <input type="checkbox" id="RepeatWeeklySat" @(Model.Event.RepeatWeeklySat ? "checked" : "")/> S
        </p>
        <p id="repeatmonthly">
        Repeats by:
            <input type="radio" name="RepeatMonthlyBy" value="1" @(Model.Event.RepeatMonthlyBy == 1 || Model.Event.RepeatMonthlyBy == 0 ? "checked" : "")/> day of the month
            <input type="radio" name="RepeatMonthlyBy" value="2" @(Model.Event.RepeatMonthlyBy == 2 ? "checked" : "")/> day of the week
        </p>
        <p>
            Starts On:
            <input class="text-input date-input" type="text" id="RepeatStartsOn" value="@Model.Event.RepeatStartsOn" />
        </p>
        <p>
            Ends:
            <input type="radio" name="RepeatEndType" type="radio" value="1" @(Model.Event.RepeatEndType == 1 || Model.Event.RepeatEndType == 0 ? "checked" : "") />
            Never
            <br />
            <input type="radio" name="RepeatEndType" type="radio" value="2" @(Model.Event.RepeatEndType == 2 ? "checked" : "") />
            After
            <input class="text-input tiny-input" type="text" id="RepeatEndOccurences" value="@(Model.Event.RepeatEndOccurences == 0 ? 5 : Model.Event.RepeatEndOccurences)" />
            occurences
            <br />
            <input type="radio" name="RepeatEndType" type="radio" value="3" @(Model.Event.RepeatEndType == 3 ? "checked" : "") />
            On
            <input class="text-input date-input" type="text" id="RepeatEndDate" value="@Model.Event.RepeatEndDate" />
        </p>
        <p>
            Summary:
            <span id="repeatsummary"></span>
        </p>
        <div class="clear">
        </div>
        <p>
            <input id="repeatsubmit" class="button" type="button" value="Done" />
        </p>
        </form>
    </div>
</div>

<div id="repeatchange" class="content-box hidden" style="color: #555;">
    <div class="content-box-header">
        <h3>
            Edit recurring event</h3>
    </div>
    <div class="content-box-content">
        <form action="">
        <p>
            <input id="erthisonly" class="button" type="button" value="Only this event" />All other events in the series will remain the same.
        </p>
        <p>
            <input id="erfollowing" class="button" type="button" value="Following events" />This and all the following events will be changed.
        </p>
        <p>
            <input id="erall" class="button" type="button" value="All events" />All events in the series will be changed.
        </p>
        <p>
            <input id="ercancel" class="button" type="button" value="Cancel this change" />
        </p>
        <input id="EditRepeatType" type="hidden" value="0" />
        <input id="EditRepeatSubmitCancel" type="hidden" value="0" />
        </form>
    </div>
</div>
@section Scripts {
    <script type="text/javascript" src="@Url.Content("/Scripts/jquery.ui.timepicker.js")"></script>
    <script type="text/javascript" src="@Url.Content("/Scripts/Events/createevent.js")"></script>
}
